# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-github-gobwas-glob
pkgver=0.2.3
pkgrel=1
pkgdesc="Go Globbing Library"
arch=('any')
url="https://github.com/gobwas/glob"
license=('MIT')
depends=('go')
source=("$pkgname-$pkgver.tar.gz::https://github.com/gobwas/glob/archive/v$pkgver.tar.gz")
sha512sums=('b91b27389e1f172d7c2c181f19ebc27d566e6bd6397cc6ad924ecf5f2ace98ecca639e020e05c9e281fb8549f9065610f7eb6070c63e3f9e7c6fd190c457e42b')

check() {
  export GO111MODULE=off
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/github.com/gobwas
  cp -a "$srcdir"/glob-$pkgver "$srcdir"/build/src/github.com/gobwas/glob
  cd "$srcdir"/build/src/github.com/gobwas/glob
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/gobwas
  cp -a "$srcdir"/glob-$pkgver "$pkgdir"/usr/share/gocode/src/github.com/gobwas/glob

  install -Dm644 glob-$pkgver/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
